//
//  MarketTableViewCell.m
//  ShouYi
//
//  Created by yrapp on 16/3/17.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "MarketTableViewCell.h"

@implementation MarketTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
 
       UIView *whriteBG = [[UIView alloc] initWithFrame:CGRectMake(0, 10, kWidth, 197.5)];
        whriteBG.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:whriteBG];
        
        _buyerName = [[UILabel alloc] initWithFrame:CGRectMake(10, 20, 100, 12)];
        _buyerName.text = @"买家:哈哈";
        _buyerName.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_buyerName];
        
        _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - 100, 20, 90, 12)];
        _stateLabel.text = @"订单完成";
        _stateLabel.font = [UIFont systemFontOfSize:13];
        _stateLabel.textAlignment = NSTextAlignmentRight;
        _stateLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:_stateLabel];
        
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 40, kWidth - 20, 1)];
        lineView.backgroundColor = [UIColor colorWithRed:244.0/255 green:244.0/255 blue:244.0/255 alpha:1];
        [self.contentView addSubview:lineView];
        
        _titleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 50, 87, 87)];
        [self.contentView addSubview:_titleImageView];
        _titleImageView.backgroundColor = [UIColor yellowColor];
        
        UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(10, 147 , kWidth - 20, 1)];
        lineView1.backgroundColor = [UIColor colorWithRed:244.0/255 green:244.0/255 blue:244.0/255 alpha:1];
        [self.contentView addSubview:lineView1];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleImageView.frame.origin.x + _titleImageView.frame.size.width + 10, 50, kWidth - 20 - _titleImageView.frame.size.width, 20)];
        _titleLabel.text = @"德国WMF福腾宝Work双耳中式不锈钢炒锅 32CM带玻璃钢锅盖";
        _titleLabel.font = [UIFont systemFontOfSize:12];
        _titleLabel.numberOfLines = 0;
        [_titleLabel sizeToFit];
        _titleLabel.textColor = [UIColor colorWithRed:87.0/255 green:87.0/255 blue:87.0/255 alpha:1];
        [self.contentView addSubview:_titleLabel];
        
        _numLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 5, 40, 20)];
        _numLabel.text = @"X2";
        _numLabel.font = [UIFont systemFontOfSize:12];
        [_numLabel sizeToFit];
        _numLabel.textColor = [UIColor colorWithRed:87.0/255 green:87.0/255 blue:87.0/255 alpha:1];
        [self.contentView addSubview:_numLabel];
        
        _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, _numLabel.frame.origin.y + _numLabel.frame.size.height + 5, 100, 20)];
        _priceLabel.font = [UIFont systemFontOfSize:12];
        _priceLabel.text = @"售价: ￥189";
        [_priceLabel sizeToFit];
        _priceLabel.textColor = [UIColor colorWithRed:87.0/255 green:87.0/255 blue:87.0/255 alpha:1];
        [self.contentView addSubview:_priceLabel];
        
        _inComeLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, _priceLabel.frame.origin.y + _priceLabel.frame.size.height + 5, 100, 20)];
        _inComeLabel.text = @"收入: ￥12";
        _inComeLabel.font = [UIFont systemFontOfSize:12];
        _inComeLabel.textColor = [UIColor colorWithRed:87.0/255 green:87.0/255 blue:87.0/255 alpha:1];
        [_inComeLabel sizeToFit];
        [self.contentView addSubview:_inComeLabel];
        
        _yingfukuan = [[UILabel alloc] initWithFrame:CGRectMake(_titleImageView.frame.origin.x, _titleImageView.frame.size.height + _titleImageView.frame.origin.y + 20, 100, 11)];
        _yingfukuan.text = @"应付款:¥ 189";
        _yingfukuan.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_yingfukuan];
        
        _shishouru = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - 100, _yingfukuan.frame.origin.y, 90, 12)];
        _shishouru.font = [UIFont systemFontOfSize:13];
        _shishouru.text = @"实收入 : ¥ 12";
        _shishouru.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_shishouru];
        
        UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(10,_yingfukuan.frame.origin.y + 10 + 10, kWidth - 20, 1)];
        lineView2.backgroundColor = [UIColor colorWithRed:244.0/255 green:244.0/255 blue:244.0/255 alpha:1];
        [self.contentView addSubview:lineView2];
        
        _deleteBUtton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _deleteBUtton.frame = CGRectMake(kWidth - 90, _shishouru.frame.origin.y + _shishouru.frame.size.height + 15, 80, 20);
        [_deleteBUtton setTitle:@"删除订单" forState:(UIControlStateNormal)];
        _deleteBUtton.titleLabel.font = [UIFont systemFontOfSize:14];
        _deleteBUtton.layer.borderColor = [UIColor redColor].CGColor;
        _deleteBUtton.layer.borderWidth = 1;
        _deleteBUtton.layer.cornerRadius = 3;
        [_deleteBUtton setTitleColor:[UIColor redColor] forState:(UIControlStateNormal)];
        [self.contentView addSubview:_deleteBUtton];
        
        
        
    }
    
    return self;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
